import service from "@/utils/request/req"
import { BaseResponse } from "@/utils/request/res"

export const system = {
    // 登录
    login: (params: any): Promise<BaseResponse> => service.post('/system/user/systemLogin', params),
    // 获取用户信息
    getUserInfo: (params: any): Promise<BaseResponse> => service.get('/system/user/getSystemUserInfo', params),
    // 用户管理
    addUser: (params: any): Promise<BaseResponse> => service.post('/system/user/addSystemUser', params),
    deleteUser: (params: any): Promise<BaseResponse> => service.delete('/system/user/deleteSystemUser', { data: params }),
    getUserList: (params: any): Promise<BaseResponse> => service.get("/system/user/getSystemUserList", { params }),
    updateUser: (params: any): Promise<BaseResponse> => service.put('/system/user/updateSystemUser', params),
    // 机构管理
    addDept: (params: any): Promise<BaseResponse> => service.post('/system/dept/addDept', params),
    getDeptList: (params: any): Promise<BaseResponse> => service.get('/system/dept/getDeptList', { params }),
    updateDept: (params: any): Promise<BaseResponse> => service.put('/system/dept/updateDept', params),
    deleteDept: (params: any): Promise<BaseResponse> => service.delete('/system/dept/deleteDept', { data: params }),
    // 字典管理
    addDict: (params: any): Promise<BaseResponse> => service.post('/system/dict/addDict', params),
    getDictList: (params: any): Promise<BaseResponse> => service.get('/system/dict/getDictList', { params }),
    getDictTypeList: (): Promise<BaseResponse> => service.get('/system/dict/getDictTypeList'),
    updateDict: (params: any): Promise<BaseResponse> => service.put('/system/dict/updateDict', params),
    deleteDict: (params: any): Promise<BaseResponse> => service.delete('/system/dict/deleteDict', { data: params }),
    // 日志管理
    getLogList: (params: any): Promise<BaseResponse> => service.get('/system/log/getLogList', { params }),
    clearLogs: (params: any): Promise<BaseResponse> => service.delete('/system/log/clearLogs', { data: params }),
    getLogDetail: (params: any): Promise<BaseResponse> => service.get('/system/log/getLogDetail', { params }),
    getLogStats: (): Promise<BaseResponse> => service.get('/system/log/getLogStats', {}),
    // 定时任务管理
    getTimerTaskList: (params: any): Promise<BaseResponse> => service.get('/system/timer/getTimerTaskList', { params }),
    addTimerTask: (data: any): Promise<BaseResponse> => service.post('/system/timer/addTimerTask', data),
    updateTimerTask: (data: any): Promise<BaseResponse> => service.put('/system/timer/updateTimerTask', data),
    deleteTimerTask: (data: any): Promise<BaseResponse> => service.delete('/system/timer/deleteTimerTask', { data }),
    toggleTimerTask: (data: any): Promise<BaseResponse> => service.post('/system/timer/toggleTimerTask', data),
    executeTimerTask: (data: any): Promise<BaseResponse> => service.post('/system/timer/executeTimerTask', data),
    getTimerTaskLogs: (params: any): Promise<BaseResponse> => service.get('/system/timer/getTimerTaskLogs', { params }),
    getTaskTypes: (): Promise<BaseResponse> => service.get('/system/timer/getTaskTypes', {}),
    getTimerTaskStats: (): Promise<BaseResponse> => service.get('/system/timer/getTimerTaskStats', {}),
    // 系统配置管理
    getSettingList: (params: any): Promise<BaseResponse> => service.get('/system/setting/getSettingList', { params }),
    getSettingDetail: (params: any): Promise<BaseResponse> => service.get('/system/setting/getSettingDetail', { params }),
    addSetting: (data: any): Promise<BaseResponse> => service.post('/system/setting/addSetting', data),
    updateSetting: (data: any): Promise<BaseResponse> => service.put('/system/setting/updateSetting', data),
    deleteSetting: (data: any): Promise<BaseResponse> => service.delete('/system/setting/deleteSetting', { data }),
    getSettingTypes: (): Promise<BaseResponse> => service.get('/system/setting/getSettingTypes', {}),
    batchUpdateSettings: (data: any): Promise<BaseResponse> => service.put('/system/setting/batchUpdateSettings', data),
    resetSettingToDefault: (data: any): Promise<BaseResponse> => service.post('/system/setting/resetToDefault', data),
    // 通知管理
    getNoticeList: (params: any): Promise<BaseResponse> => service.get('/system/notice/getNoticeList', { params }),
    getMyNoticeList: (params: any): Promise<BaseResponse> => service.get('/system/notice/getMyNoticeList', { params }),
    getNoticeDetail: (params: any): Promise<BaseResponse> => service.get('/system/notice/getNoticeDetail', { params }),
    addNotice: (data: any): Promise<BaseResponse> => service.post('/system/notice/addNotice', data),
    updateNotice: (data: any): Promise<BaseResponse> => service.put('/system/notice/updateNotice', data),
    deleteNotice: (data: any): Promise<BaseResponse> => service.delete('/system/notice/deleteNotice', { data }),
    sendNotice: (data: any): Promise<BaseResponse> => service.post('/system/notice/sendNotice', data),
    markNoticeRead: (data: any): Promise<BaseResponse> => service.post('/system/notice/markNoticeRead', data),
    getUnreadNoticeCount: (): Promise<BaseResponse> => service.get('/system/notice/getUnreadCount', {}),
    getNoticeStats: (): Promise<BaseResponse> => service.get('/system/notice/getNoticeStats', {}),
    // 系统首页相关API
    getSystemStats: (): Promise<BaseResponse> => service.get('/system/home/getSystemStats', {}),
    getSystemHealth: (): Promise<BaseResponse> => service.get('/system/home/getSystemHealth', {}),
    getRealTimeMonitor: (): Promise<BaseResponse> => service.get('/system/home/getRealTimeMonitor', {}),
    getPerformanceTrends: (params: any): Promise<BaseResponse> => service.get('/system/home/getPerformanceTrends', { params }),
    getConcurrencyMonitor: (): Promise<BaseResponse> => service.get('/system/home/getConcurrencyMonitor', {}),
    // 菜单管理
    getMenuList: (params?: any): Promise<BaseResponse> => service.get('/system/menu/getMenuList', { params }),
    getMenuAll: (params?: any): Promise<BaseResponse> => service.get('/system/menu/getMenuAll', { params }),
    getUserMenu: (params: { userType: string, roleType: string }): Promise<BaseResponse> => service.get('/system/menu/getUserMenu', { params }),
    addMenu: (data: any): Promise<BaseResponse> => service.post('/system/menu/addMenu', data),
    updateMenu: (data: any): Promise<BaseResponse> => service.put('/system/menu/updateMenu', data),
    deleteMenu: (data: any): Promise<BaseResponse> => service.delete('/system/menu/deleteMenu', { data }),
    // RBAC - 角色与权限
    getRoleList: (params: any): Promise<BaseResponse> => service.get('/system/rbac/getRoleList', { params }),
    getPermissionList: (): Promise<BaseResponse> => service.get('/system/rbac/getPermissionList'),
    addRole: (data: any): Promise<BaseResponse> => service.post('/system/rbac/addRole', data),
    updateRole: (data: any): Promise<BaseResponse> => service.put('/system/rbac/updateRole', data),
    deleteRole: (data: any): Promise<BaseResponse> => service.delete('/system/rbac/deleteRole', { data }),
    getPermissionAll: (): Promise<BaseResponse> => service.get('/system/rbac/getPermissionList'),
    getAllRoles: (): Promise<BaseResponse> => service.get('/system/rbac/getAllRoles'),
};

export const main = {};